package service;

import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import javax.microedition.xml.rpc.Operation;
import javax.microedition.xml.rpc.Type;
import javax.microedition.xml.rpc.ComplexType;
import javax.microedition.xml.rpc.Element;

public class Service_Stub implements Service, javax.xml.rpc.Stub {
    
    private String[] _propertyNames;
    private Object[] _propertyValues;
    
    public Service_Stub() {
        _propertyNames = new String[] { ENDPOINT_ADDRESS_PROPERTY };
        _propertyValues = new Object[] { "http://aspspider.info/mostafaizz/Service.asmx" };
    }
    
    public void _setProperty( String name, Object value ) {
        int size = _propertyNames.length;
        for (int i = 0; i < size; ++i) {
            if( _propertyNames[i].equals( name )) {
                _propertyValues[i] = value;
                return;
            }
        }
        String[] newPropNames = new String[size + 1];
        System.arraycopy(_propertyNames, 0, newPropNames, 0, size);
        _propertyNames = newPropNames;
        Object[] newPropValues = new Object[size + 1];
        System.arraycopy(_propertyValues, 0, newPropValues, 0, size);
        _propertyValues = newPropValues;
        
        _propertyNames[size] = name;
        _propertyValues[size] = value;
    }
    
    public Object _getProperty(String name) {
        for (int i = 0; i < _propertyNames.length; ++i) {
            if (_propertyNames[i].equals(name)) {
                return _propertyValues[i];
            }
        }
        if (ENDPOINT_ADDRESS_PROPERTY.equals(name) || USERNAME_PROPERTY.equals(name) || PASSWORD_PROPERTY.equals(name)) {
            return null;
        }
        if (SESSION_MAINTAIN_PROPERTY.equals(name)) {
            return new Boolean(false);
        }
        throw new JAXRPCException("Stub does not recognize property: " + name);
    }
    
    protected void _prepOperation(Operation op) {
        for (int i = 0; i < _propertyNames.length; ++i) {
            op.setProperty(_propertyNames[i], _propertyValues[i].toString());
        }
    }
    
    public String HelloWorld1(String str) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            str
        };
        
        Operation op = Operation.newInstance( _qname_operation_HelloWorld1, _type_HelloWorld1, _type_HelloWorld1Response );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "http://tempuri.org/HelloWorld1" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }
        
        return (String )((Object[])resultObj)[0];
    }
    
    public String HelloWorld2(String str, String str1) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            str,
            str1
        };
        
        Operation op = Operation.newInstance( _qname_operation_HelloWorld2, _type_HelloWorld2, _type_HelloWorld2Response );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "http://tempuri.org/HelloWorld2" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }
        
        return (String )((Object[])resultObj)[0];
    }
    
    public ss HelloWorld3(String str, String str1, String str2) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            str,
            str1,
            str2
        };
        
        Operation op = Operation.newInstance( _qname_operation_HelloWorld3, _type_HelloWorld3, _type_HelloWorld3Response );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "http://tempuri.org/HelloWorld3" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }
        
        return ss_fromObject((Object[])((Object[]) resultObj)[0]);
    }
    
    public String HelloWorld() throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
        };
        
        Operation op = Operation.newInstance( _qname_operation_HelloWorld, _type_HelloWorld, _type_HelloWorldResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "http://tempuri.org/HelloWorld" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }
        
        return (String )((Object[])resultObj)[0];
    }
    
    private static ss ss_fromObject( Object obj[] ) {
        if(obj == null) return null;
        ss result = new ss();
        result.setFirst((String )obj[0]);
        result.setSecond((String )obj[1]);
        result.setThird((String )obj[2]);
        result.setFourth((String )obj[3]);
        return result;
    }
    
    protected static final QName _qname_operation_HelloWorld = new QName( "http://tempuri.org/", "HelloWorld" );
    protected static final QName _qname_operation_HelloWorld3 = new QName( "http://tempuri.org/", "HelloWorld3" );
    protected static final QName _qname_operation_HelloWorld2 = new QName( "http://tempuri.org/", "HelloWorld2" );
    protected static final QName _qname_operation_HelloWorld1 = new QName( "http://tempuri.org/", "HelloWorld1" );
    protected static final QName _qname_HelloWorld1Response = new QName( "http://tempuri.org/", "HelloWorld1Response" );
    protected static final QName _qname_HelloWorldResponse = new QName( "http://tempuri.org/", "HelloWorldResponse" );
    protected static final QName _qname_HelloWorld2Response = new QName( "http://tempuri.org/", "HelloWorld2Response" );
    protected static final QName _qname_HelloWorld = new QName( "http://tempuri.org/", "HelloWorld" );
    protected static final QName _qname_HelloWorld3Response = new QName( "http://tempuri.org/", "HelloWorld3Response" );
    protected static final QName _qname_HelloWorld3 = new QName( "http://tempuri.org/", "HelloWorld3" );
    protected static final QName _qname_HelloWorld2 = new QName( "http://tempuri.org/", "HelloWorld2" );
    protected static final QName _qname_HelloWorld1 = new QName( "http://tempuri.org/", "HelloWorld1" );
    protected static final Element _type_HelloWorld2;
    protected static final Element _type_HelloWorld1Response;
    protected static final Element _type_HelloWorld2Response;
    protected static final Element _type_HelloWorld3Response;
    protected static final Element _type_HelloWorldResponse;
    protected static final Element _type_HelloWorld;
    protected static final Element _type_HelloWorld1;
    protected static final Element _type_HelloWorld3;
    
    static {
        _type_HelloWorld1Response = new Element( _qname_HelloWorld1Response, _complexType( new Element[] {
            new Element( new QName( "http://tempuri.org/", "HelloWorld1Result" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_HelloWorldResponse = new Element( _qname_HelloWorldResponse, _complexType( new Element[] {
            new Element( new QName( "http://tempuri.org/", "HelloWorldResult" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_HelloWorld = new Element( _qname_HelloWorld, _complexType( new Element[] {
        }), 1, 1, false );
        _type_HelloWorld2Response = new Element( _qname_HelloWorld2Response, _complexType( new Element[] {
            new Element( new QName( "http://tempuri.org/", "HelloWorld2Result" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_HelloWorld3Response = new Element( _qname_HelloWorld3Response, _complexType( new Element[] {
            new Element( new QName( "http://tempuri.org/", "HelloWorld3Result" ), _complexType( new Element[] {
                new Element( new QName( "http://tempuri.org/", "first" ), Type.STRING, 0, 1, false ),
                new Element( new QName( "http://tempuri.org/", "second" ), Type.STRING, 0, 1, false ),
                new Element( new QName( "http://tempuri.org/", "third" ), Type.STRING, 0, 1, false ),
                new Element( new QName( "http://tempuri.org/", "fourth" ), Type.STRING, 0, 1, false )}), 1, 1, false )}), 1, 1, false );
        _type_HelloWorld3 = new Element( _qname_HelloWorld3, _complexType( new Element[] {
            new Element( new QName( "http://tempuri.org/", "str" ), Type.STRING, 0, 1, false ),
            new Element( new QName( "http://tempuri.org/", "str1" ), Type.STRING, 0, 1, false ),
            new Element( new QName( "http://tempuri.org/", "str2" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_HelloWorld2 = new Element( _qname_HelloWorld2, _complexType( new Element[] {
            new Element( new QName( "http://tempuri.org/", "str" ), Type.STRING, 0, 1, false ),
            new Element( new QName( "http://tempuri.org/", "str1" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_HelloWorld1 = new Element( _qname_HelloWorld1, _complexType( new Element[] {
            new Element( new QName( "http://tempuri.org/", "str" ), Type.STRING, 0, 1, false )}), 1, 1, false );
    }
    
    private static ComplexType _complexType( Element[] elements ) {
        ComplexType result = new ComplexType();
        result.elements = elements;
        return result;
    }
}
